var t = getApp();

Page({
    data: {
        dy_password: "",
        dy_deeplink: "",
        goods_id: "",
        detail: {},
        show1: !1,
        customer_open: !1,
        tiktok_popup: !1,
        indicator_dots: !1,
        posterShow: !1,
        language: "",
        current: 1,
        xqtop: 0,
        hoet: !1,
        show_dy_password: !1
    },
    close_show_dy: function() {
        this.setData({
            show_dy_password: !1
        });
    },
    onLoad: function(a) {
        var o = wx.getStorageSync("langIndex");
        if (this.setData({
            language: o.en
        }), a.scene) {
            var e = decodeURIComponent(a.scene);
            if (e) {
                var i;
                i = e.split(","), this.setData({
                    goods_id: i[0]
                }), t._setMid(i[1]);
            }
        }
        a.goods_id && this.setData({
            goods_id: a.goods_id
        }), this.getData();
    },
    onPageScroll: function(t) {
        var a = t.scrollTop;
        a > 35 ? this.data.hoet || this.setData({
            hoet: !0
        }) : this.data.hoet && this.setData({
            hoet: !1
        }), this.setData({
            datop: a
        });
    },
    touchStart: function(t) {
        var a = t.touches[0].pageY;
        this.setData({
            sy: a
        });
    },
    touchMove: function(t) {
        this.setData({
            endy: t.touches[0].pageY
        });
    },
    touchEnd: function() {
        this.data.sy - this.data.endy > 100 && this.data.showIn && this.setData({
            boxHeight: "",
            xqBoxShow: !0,
            showIn: !1
        });
    },
    getTap: function(t) {
        var a = t.currentTarget.id;
        this.setData({
            current: a
        }), 1 == a ? wx.pageScrollTo({
            scrollTop: 0,
            duration: 300
        }) : 2 == a ? wx.pageScrollTo({
            scrollTop: this.data.pjtop,
            duration: 300
        }) : 3 == a && (this.setData({
            xqBoxShow: !0
        }), wx.pageScrollTo({
            scrollTop: this.data.xqtop + 400,
            duration: 300
        }));
    },
    closePop: function() {
        this.setData({
            show1: !1
        });
    },
    gotoHome: function() {
        wx.reLaunch({
            url: "/packageF/cps/index/index"
        });
    },
    gotoMember: function() {
        wx.reLaunch({
            url: "/packageG/member_v2/member_v2"
        });
    },
    gotoChat: function(a) {
        var o = this.data.detail.cservice.cservice + "&goods_id=" + this.data.goods_id;
        wx.navigateTo({
            url: o,
            fail: function(a) {
                t.tips("客服路由出错");
            }
        });
    },
    showPop: function() {
        var a = t._isTextEmpty(this.data.detail.cservice.service_mobile) && t._isTextEmpty(this.data.detail.cservice.service_QRcode);
        if (t._isTextEmpty(this.data.detail.cservice) && a) return t.tips("抱歉，暂未设置客服信息");
        t._isTextEmpty(this.data.detail.cservice) || !a ? this.setData({
            show1: !0
        }) : this.gotoChat({
            currentTarget: {
                dataset: {
                    cservice: this.data.detail.cservice.cservice
                }
            }
        });
    },
    setPosterShow: function() {
        this.setData({
            posterShow: !this.data.posterShow,
            tiktok_popup: !1
        });
    },
    ShowTiktokPoupup: function() {
        this.setData({
            tiktok_popup: !0
        });
    },
    show_dialog: function() {
        this.setData({
            show_dy_password: !0,
            tiktok_popup: !1
        });
    },
    code_link: function() {
        var a = this;
        wx.setClipboardData({
            data: this.data.dy_password,
            success: function() {
                t.tips("口令已复制，打开抖音app下单！"), a.setData({
                    tiktok_popup: !1
                });
            },
            fail: function(t) {
                a.detail.detail_url && a.getTikTokCps(a.detail.detail_url);
            }
        });
    },
    gotoindex: function() {
        wx.navigateTo({
            url: "/packageG/index/index"
        });
    },
    toGroupCode: function() {
        "home" === this.data.detail.group_code.jump_mode ? wx.reLaunch({
            url: "/packageE/groupCode/groupCode"
        }) : this.data.detail.group_code.code_mini_url && wx.navigateTo({
            url: this.data.detail.group_code.code_mini_url
        });
    },
    getTikTokCps: function(a) {
        var o = this;
        t._getNetWork({
            url: t.getNetAddresss("plugin.tiktok-cps.api.goods.tranfer-link"),
            data: {
                detail_url: a
            },
            success: function(t) {
                var a = t.data, e = a.data;
                0 != a.result && o.setData({
                    dy_password: e.dy_password,
                    dy_deeplink: e.dy_deeplink
                });
            }
        });
    },
    onClose: function() {
        this.setData({
            tiktok_popup: !1
        });
    },
    getData: function() {
        var a = this;
        t._getNetWork({
            url: t.getNetAddresss("plugin.tiktok-cps.api.goods.good-detail"),
            data: {
                goods_id: this.data.goods_id
            },
            success: function(o) {
                var e = o.data, i = e.data, s = e.result, d = e.msg;
                if (0 == s) return t.tips(d);
                i.imgs && i.imgs.length > 1 && a.setData({
                    indicator_dots: !0
                }), a.setData({
                    detail: i || {}
                }), a.getTikTokCps(i.detail_url);
            }
        });
    },
    previewImg: function(t) {
        var a;
        a = t.currentTarget.dataset.key, wx.previewImage({
            current: a ? this.data.detail.imgs[a] : this.data.detail.imgs,
            urls: this.data.detail.imgs
        });
    },
    onReady: function() {},
    onShow: function() {
        var t = this;
        this.createSelectorQuery().select(".foShowBox").boundingClientRect(function(a) {
            t.setData({
                xqtop: a.top - 100
            });
        }).exec();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {
        return {
            path: "/packageF/cps/detail/detail?goods_id=".concat(this.data.goods_id)
        };
    }
});